import type { PageParams, PageResult } from '@/types/global'
import type { BannerItem, CategoryItem, GuessItem, HotItem } from '@/types/home'
import { http } from '@/utils/http'
/**
 * 获取轮播图数据
 * @param distributionSite 1首页 2内容页
 * @returns 轮播数据
 */
export const getHomeBanner = (distributionSite: number = 1) => {
  return http<BannerItem[]>({
    method: 'GET',
    url: '/home/banner',
    data: {
      distributionSite,
    },
  })
}

/**
 * 获取首页分类信息
 *
 * @returns 返回获取到的首页分类信息
 */
export const getHomeCategory = () => {
  return http<CategoryItem[]>({
    method: 'GET',
    url: '/home/category/mutli',
  })
}

/**
 * 获取首页热门内容
 *
 * @returns 返回请求结果
 */
export const getHomeHot = () => {
  return http<HotItem[]>({
    method: 'GET',
    url: '/home/hot/mutli',
  })
}

/**
 * 获取首页猜你喜欢商品列表
 *
 * @returns 返回一个包含商品信息的Promise对象
 */
export const getHomeGoodsGuessLike = (data?: PageParams) => {
  return http<PageResult<GuessItem>>({
    method: 'GET',
    url: '/home/goods/guessLike',
    data,
  })
}
